﻿#region Using Directives

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Xml.Linq;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    /// <summary>
    /// Class used as guid based enumeration list that holds the possible types for Visit Status (implemented with the Guid's hardcoded as properties to enable the text to change, but Guid's must remain or code change is necessary!!!)
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.DataAccess.Factory.VisitStatusTypeListFactory, MarketPulse.DataAccess.Factory")]
    public class VisitStatusTypeList : MarketPulseNameValueListBase<Guid, string>
    {
        #region Member Variables

            /// <summary>
            /// List to hold all the possible VisitStatus types
            /// </summary>
            private static VisitStatusTypeList mVisitStatusTypes;

        #endregion

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// via only the static factory methods provided.
            /// </summary>
            private VisitStatusTypeList()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method used to get a list of name/value pairs representing VisitStatusTypes 
                /// from the database.  Internally this accesses a static field so this
                /// class is effectively a lazily instantiated singleton.
                /// </summary>
                public static void GetList(EventHandler<DataPortalResult<VisitStatusTypeList>> callback)
                {

                    if (mVisitStatusTypes == null)
                    {
                        DataPortal.BeginFetch<VisitStatusTypeList>((o, e) =>
                        {
                            mVisitStatusTypes = e.Object;
                            callback(o, e);
                        });
                    }
                    else
                    {
                        callback(null, new DataPortalResult<VisitStatusTypeList>(mVisitStatusTypes, null, null));
                    }
                }

                /// <summary>
                /// Method used to get a list of name/value pairs representing VisitStatusTypes 
                /// from the database.  Internally this accesses a static field so this
                /// class is effectively a lazily instantiated singleton.
                /// </summary>
                public static VisitStatusTypeList GetList()
                {
                    // Load the list if it's null
                    if (mVisitStatusTypes == null)
                    {
                        mVisitStatusTypes = DataPortal.Fetch<VisitStatusTypeList>();
                    }
                    return mVisitStatusTypes;
                }               

            #endregion

        #endregion

        #region Properties
               
            /// <summary>The Guid for the 'Created' Status</summary>
            public static Guid Created { get { return new Guid("8B13CBFE-EF6D-40F8-A142-46E0604C48FD"); } }

            /// <summary>The Guid for the 'Released' Status</summary>
            public static Guid Released { get { return new Guid("1C2785F1-4941-43A8-800F-771DA0F5E7AE"); } }

            /// <summary>The Guid for the 'Assigned' Status</summary>
            public static Guid Assigned { get { return new Guid("62FD3065-EB39-483D-81E0-50BC1DF84551"); } }

            /// <summary>The Guid for the 'Transferred' Status</summary>
            public static Guid Transferred { get { return new Guid("3F3C7541-D89A-4B9E-B268-788B7C918D1F"); } }

            /// <summary>The Guid for the 'Completed' Status</summary>
            public static Guid Completed { get { return new Guid("210F6A66-6DBF-411C-B6F3-3DB656C5EC97"); } }

            /// <summary>The Guid for the 'DataEntryInProgress' Status</summary>
            public static Guid DataEntryInProgress { get { return new Guid("9B46B126-C0C3-4127-BBA3-0190ED89B529"); } }

            /// <summary>The Guid for the 'AwaitingQA' Status</summary>
            public static Guid AwaitingQA { get { return new Guid("87A8DA32-923D-4E3F-A3C6-1705D2E7E897"); } }

            /// <summary>The Guid for the 'QAInProgress' Status</summary>
            public static Guid QAInProgress { get { return new Guid("E44C054B-8ADE-42EB-98B8-045FA0284D0A"); } }

            /// <summary>The Guid for the 'QAApproved' Status</summary>
            public static Guid QAApproved { get { return new Guid("A4CDC30E-E0BF-49DE-9814-D0FB9363222B"); } }

            /// <summary>The Guid for the 'QAOnHold' Status</summary>
            public static Guid QAOnHold { get { return new Guid("C8D91989-830D-4FEA-926F-8DBD6127087B"); } }

            /// <summary>The Guid for the 'QAFailed' Status</summary>
            public static Guid QAFailed { get { return new Guid("F9598B1C-A91D-46BD-90E0-68621C55F801"); } }

            /// <summary>The Guid for the 'ReadyForTransfer' Status</summary>
            public static Guid ReadyForTransfer { get { return new Guid("8FBF86C5-66B7-4281-A385-CFFB32E4BAC1"); } }

        #endregion

    }
}
